package org.activequant.util.log;

import java.util.HashMap;

import org.activequant.core.domainmodel.InstrumentSpecification;
/**
 * An abstract class. Implements the IAQLogger interface. Holds the following associated variables:
 * <ul>
 * <li>thePositions(HashMap&lt;Long, Double&gt;)</li>
 * <li>thePositionValue(HashMap&lt;Long, Double&gt;)</li>
 * <li>theInstrumentValuationPrices(HashMap&lt;Long, Double&gt;)</li>
 * </ul>
 * @author Dimitar
 *
 */
public abstract class LoggerBase implements IAQLogger {
	/**
	 * loops the given aSpecs(InstrumentSpecification...) and for each InstrumentSpecification whose id(long) is not mapped as a key in the
	 * associated thePositions(HashMap&lt;Long, Double&gt;) it adds an id - 0 mapping into the associated thePositions(HashMap&lt;Long, Double&gt;)
	 * and theInstrumentValuationPrices(HashMap&lt;Long, Double&gt;)
	 * @param aSpecs
	 */
	public void announceInstrumentSpecifications(InstrumentSpecification... aSpecs) {
		for (InstrumentSpecification mySpec : aSpecs) {
			long myIId = mySpec.getId();
			if (!thePositions.containsKey(myIId)) {
				thePositions.put(myIId, 0.0);
				theInstrumentValuationPrices.put(myIId, 0.0);
			}
		}
	}
	/**
	 * protected HashMap&lt;Long, Double&gt; thePositions = new HashMap&lt;Long, Double&gt;();
	 */
	protected HashMap<Long, Double> thePositions = new HashMap<Long, Double>();
	/**
	 * protected HashMap&lt;Long, Double&gt; thePositionValue = new HashMap&lt;Long, Double&gt;();
	 */
	protected HashMap<Long, Double> thePositionValue = new HashMap<Long, Double>();
	/**
	 * protected HashMap&lt;Long, Double&gt; theInstrumentValuationPrices = new HashMap&lt;Long, Double&gt;();
	 */
	protected HashMap<Long, Double> theInstrumentValuationPrices = new HashMap<Long, Double>();

	
}
